<?php
class ControllerCommonSearch extends Controller {
	public function index() {
		$this->load->language('common/search');

		$data['text_search'] = $this->language->get('text_search');

		if (isset($this->request->get['search'])) {
			$data['search'] = $this->request->get['search'];
		} else {
			$data['search'] = '';
		}

		$this->load->model('common/keywords');
        $device = is_mobile() && !is_pad() ? 0 : 1;
        $keywords = $this->model_common_keywords->getKeywords($device);
        $data['keywords'] = array();
        if ($keywords) {
            foreach ($keywords as $keyword) {
                $data['keywords'][] = array(
                    'link' => uriLink('product/search', 'search=' . $keyword['keyword']),
                    'title' => $keyword['keyword']
                );
            }
        }

		return $this->load->view('common/search', $data);
	}
}